#pragma once

#include <algorithm>
#include <boost\graph\graph_traits.hpp>
#include "dialoguetree.h"
#include "fileio.h"
#include "actor.h"

class dialogueHandler {
	void beginDialogue(NPC* npc, Player* player);

};

void dialogueHandler::beginDialogue(NPC* npc, Player* player) {
	FileIO fileIO;
	dialogueTree NPCDialogue = fileIO.loadDialogue(npc->getDialoguePath().c_str());
	boost::graph_traits<dialogueTree>::vertex_descriptor currentTopicNode;

	//Find GREETING node
	std::pair<boost::graph_traits<dialogueTree>::vertex_iterator,boost::graph_traits<dialogueTree>::vertex_iterator> topicList = boost::vertices(NPCDialogue);
	currentTopicNode = *(std::find_if(topicList.first, topicList.second,
		[&] (boost::graph_traits<dialogueTree>::vertex_descriptor topicVertex)->bool {
			if (NPCDialogue[topicVertex].ID == "GREETING")
				return true;
			else return false;
		}
	));
	
	//Open GREETING node, display appropriate greeting response
	//Select choice
	//Move to chosen topic node
	//Display appropriate response
	//Rinse and repeat
}